VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "NCMethodFixture"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private mHolder As ObjectHolder
Private mName As String
Private mDesc As ClassDescriptor

Private mError As Integer

Public Sub init(holder As ObjectHolder, name As String, desc As ClassDescriptor)
Set mHolder = holder
mName = name
Set mDesc = desc
End Sub


Public Sub forward(notify As Object)
notify.StartMethod Me
On Error GoTo handler
forwardFineMethods
GoTo exitMethod

handler:
'Exit Sub

exitMethod:
notify.EndMethod

End Sub

Private Sub forwardFineMethods()
setup
callMethod
teardown
End Sub
Private Sub setup()
Dim aTimer As New AutoTimer
aTimer.reportTo Me
'Errors raised in object are allowed to propagate up
If mDesc.hasSetup Then
    mHolder.object.setup
End If
End Sub
Private Sub callMethod()
Dim aTimer As New AutoTimer
aTimer.reportTo Me
On Error GoTo handler
InvokeHook mObject.object, mName, INVOKE_FUNC
Exit Sub
handler:
mError = Err.Number
End Sub
Private Sub teardown()
Dim aTimer As New AutoTimer
aTimer.reportTo Me
On Error GoTo handler
If mDesc.hasTearDown Then
    mHolder.object.teardown
End If
Exit Sub
handler:
mError = Err.Number
End Sub
Public Sub reportTime(elTime As Double)
mElapsedTime = mElapsedTime + elTime
End Sub


Public Property Get name() As String
name = mName
End Property
Public Property Get elapsedTime() As Double
elapsedTime = mElapsedTime
End Property

Public Property Get errorNumber() As Integer
errorNumber = mError
End Property

